package org.example.main.multi_threading;

/**
 * @Author: WangShengJie
 * @Date: 2025/6/1
 */
public class CSDemo {

    private final static long COUNT = 100000l;

    public static void main(String[] args) {
        oneThread();
        moreThread();
    }

    public static void oneThread() {
        long start = System.currentTimeMillis();
        for (long i = 0; i < COUNT; i++) {
        }
        System.out.println("单线程结束：用时：【"+(System.currentTimeMillis()-start)+"】");
    }

    public static void moreThread() {
        long start = System.currentTimeMillis();
        Thread thread = new Thread(() -> {
            for (long i = 0; i < COUNT; i++) {
//                System.out.println("***");
            }
            System.out.println("***");
        });
        thread.start();
        System.out.println("多线程结束：用时：【"+(System.currentTimeMillis()-start)+"】");
    }
}
